const mongoose = require('mongoose')
const md5 = require('blueimp-md5')
const UserModel = require('../model/userModel')


function save(){
  const userModel = new UserModel({name:'Jack', email:'321892910@163.com'})

  userModel.save((err, doc)=>{
    console.log(err, doc)

  })
}

function find(){
  UserModel.find({_id:'627246efa5910745c7f8bd59'}, (err, users)=>{
    console.log(err, users)
  })

  UserModel.findOne({_id:'627246efa5910745c7f8bd59'}, (err, user)=>{
    console.log(err, user)

  })

}

function update(){
  UserModel.findByIdAndUpdate({_id:'627246efa5910745c7f8bd59'}, {name:'Mary'}, (err, old)=>{
    console.log(err, old)

  })
}

function remove(){
  UserModel.remove({_id:'627246efa5910745c7f8bd59'}, (err, info)=>{
    console.log(err, info)

  })
}

